#include "../include/ehome.h"
#include "get_acc.h"

struct acc_info pre_acc={0};

void step(int fd,int sd,struct sockaddr *to){
    struct acc_info acc={0};
    int ret=0;
    get_acc(fd,&acc);
    if(abs(acc.x - pre_acc.x) > STEP_SCOPE ||   \
       abs(acc.y - pre_acc.y) > STEP_SCOPE ||   \
       abs(acc.z - pre_acc.z) > STEP_SCOPE ){
    ret=1;
    }
    memcpy(&pre_acc,&acc,sizeof(struct acc_info));
   // pr_debug("the step is %d",ret);
    sendto(sd,&ret,sizeof(ret),0,to,sizeof(struct sockaddr));
}


